#include <stdio.h>
#include <string.h>
#include <stdlib.h>

#include "esp_log.h"
#include "esp_event.h"
#include "esp_netif.h"
#include "esp_eth.h"

#include "network_manager.h"
#include "app_eth.h"

static const char *TAG = "NETWORK_MANAGER";
static esp_netif_t *wifi_netif = NULL;
static esp_netif_t *eth_netif = NULL;
static net_type_t active_net = NET_TYPE_NONE;
static bool use_wifi = true;
static bool is_dhcp_enabled = true;

void network_manager_init(void)
{
    ESP_ERROR_CHECK(esp_netif_init());
    ESP_ERROR_CHECK(esp_event_loop_create_default());

    app_eth_init();
}

void network_manager_deinit(void)
{
    // TODO
}

bool network_manager_is_connected(void)
{
    return app_eth_is_connected();
}

const net_ip_info_t* network_manager_get_ip(void)
{
    return app_eth_ip_get();
}
